{% extends 'base.html' %}
{% block title %}Brisbane Coupon{% endblock %}
{% block stylesheet %}
{{ block.super }}
{% endblock%}

{% block javascript %}
{{ block.super }}
<script>
$(document).ready(function() {
	/*
    $("body").click(function(event) {
        if ($(event.target).is(".couponBtn")) {
            var couponId = $(event.target).attr("id");
            {% if local_test %}
            var address = 'http://localhost:8000/coupon/sms/' + couponId;
            {% else %}
            var address = 'http://brisbanecoupon.com/coupon/sms/' + couponId;
            {% endif  %}

            tkstickyMsg("Sending....", "good");
            
            $.get(address, function(data){
                if(data.result.success == true) {
                	tkstickyMsg(data.result.msg, "good");
                } else {
                	tkstickyMsg(data.result.msg, "good");
                }
            }).complete(function(){
            });
            return false;
        }
    });
    */    
});
</script>
{% endblock%}

{% block content %}

<div id="dLayout">
  <div id="dSearch">
    <form method="get" action="">
    {{ search_form.q }}
    </form>
  </div> <!-- end dSearch-->
</div> <!-- end dLayout-->

<div id="dWrapper">
  <div id="dLineContent">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>Event</th>
          <th>Store</th>
          <th>Date</th>
          <th width="25%">Coupon</th>
        </tr>
      </thead>
      <tbody>
      {% for coupon in objects_page.object_list %}
        <tr>
          <td><a href="{{ coupon.event.url }}">{{ coupon.name }}</a><br /><p style="font-size:0.7em;">{{ coupon.event.name|safe }}</p></td>
          <td><a href="{{ coupon.event.store.url }}">{{ coupon.event.store }}</a></td>
          <td>{{ coupon.event.get_day }}</td>
          <td width="25%">
            <div class="cDowncoupon">
              {% if not coupon.event.active %}
              <a href="#">이벤트 기간이 끝났습니다.</a>
              {% else %}
              <a class="couponBtn" href="{{ coupon.event.url }}" id="{{ coupon.id }}">쿠폰받기<span class="cLeftcoupon"><span class="cLeftNumber">{{ coupon.get_status }}</span></span></a>
              {% endif %}
            </div>
          </td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    
    {% include "paginator.html" %}
  </div>
</div> <!--dWrapper-->
    
{% endblock %}
